FROM python:3.8.8

# MAINTAINER指定作者
MAINTAINER zkl
# ENV设置环境变量
ENV TZ=Asia/Shanghai TZS=Asia/Shanghai

# ADD复制命令，将文件复制到镜像中。将当前目录.添加到code文件夹下
ADD . /code
# LABEL用于为镜像添加元数据
LABEL version="1.0" description="这是一个schedule定时任务docker容器，包括vi/telnet/cron、python388和requirements的库文件" by="zkl"
# WORKDIR设置工作目录
WORKDIR /code

# 设置时区为东八区（中国标准时间）
RUN echo > /etc/apt/sources.list && \
    sed -i "1ideb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" /etc/apt/sources.list && \
    sed -i "2ideb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" /etc/apt/sources.list && \
    sed -i "3ideb https://mirrors.aliyun.com/debian-security/ bullseye-security main" /etc/apt/sources.list && \
    sed -i "4ideb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main" /etc/apt/sources.list && \
    sed -i "5ideb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib" /etc/apt/sources.list && \
    sed -i "6ideb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib" /etc/apt/sources.list && \
    sed -i "7ideb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" /etc/apt/sources.list && \
    sed -i "8ideb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" /etc/apt/sources.list && \
    apt-get update -y && \
    apt-get install -y vim && \
    apt-get install -y telnet && \
    apt-get install -y cron && \
    ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 安装依赖
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

# VOLUME 用于指定持久化目录（指定此目录可以被挂载出去）
VOLUME ["/code", "/var/logs"]
# 设置容器启动时运行的命令
# CMD ["/bin/bash -c", "echo", "your docker container init successfully. contain vi vim telnet crontab and python388 requements "]
